
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<script src="../js/vue.min.js"></script>
		<script src="../js/vant.min.js"></script>
		<script src="../js/ajax.js"></script>
		<link rel="stylesheet" href="../css/index.css" />
		<script src="html5plus://ready"></script>
		<script src="../js/listener_other.js"></script>
		
		<title>忘记密码</title>
	</head>
	<body placeholder="nihao">
		<div id="app">
			<van-row style="background-color:orangered; height:100px;line-height:46px;padding-top: 2%;">
			  <van-col span="2" offset="1" ><van-icon color="white" name="arrow-left" size="20px" style="margin-top: 29px;" /></van-col>
			 <van-col span="10" offset="4"><h2 style="color:white" >忘记密码</h2></van-col>
			 
			</van-row>
			<van-row style="margin-top:3% ;">
			 	  <van-col span="18" offset="2" >
			 	  	<input type="text" placeholder="请输入手机号" id="phone" v-model="phone"  name="phone" style="border: none;" /></van-col>
			   </van-row>
			 <van-row style="margin-top:5% ;">
			 	  <van-col span="14" offset="2" ><input type="text" placeholder="验证码(六位数字验证码)" v-model="yanzheng" id="yanzhengma"  name="yanzhengma" style="border: none;" /></van-col>
				  <van-col span="7" ><van-button id="yanzheng" type="danger" @click="yanzhengma" size="large">获取验证码</van-button></van-col>
				 
			 </van-row>
			   
			 
			 </van-row>
			  <van-row style="margin-top:10% ;">
			 	  <van-col span="20" offset="2" >
			 	  	<van-button type="danger" @click="queding" size="large">确定</van-button>
			 	  	</van-col>
				  
				 
			 </van-row>
			  
			

		</div>
		<script type="text/javascript">
		

			var vm = new Vue({

				el: "#app",

				data: {
					phone:"",
					yanzheng:""
					
					

				},

				methods: {
					
					yanzhengma:function(){
						var a=parseInt(this.phone);
						
						ajax({
							url: "http://dsapi.ysd3g.com/api/SendForgotPasswordPhoneCode",
							dataType:"jsonp",
							data: {
								phone:vm.phone,
								
							},
							 success(res){
								console.log(JSON.stringify(res))
								if (res.Error) {
									vm.$toast.fail(res.Msg);
								} else{
									alert("验证码已发送,请注意查收"+res.Code);
								}
							}
					
						
						})
						
						
					
					},
					queding: function(res) {

						
							ajax({
								url: "http://dsapi.ysd3g.com/api/ValidatePhone",
								dataType:"jsonp",
								data: {
									phone:vm.phone,
									 phoneCode:vm.yanzheng
								},
								 success(res){
									if (res.Error) {
										vm.$toast.fail(res.Msg);
									} else{
									plus.webview.create("../personcenter/restPassword.html","restPassword",{}, 
									{phone:vm.phone}).show();
									}
								}
						
							
							})
						
						
					}
				}

			});
		</script>
	</body>
</html>